import {request} from "../utils/request";
import { ObjTy } from "../types/common";

// 用户登录
export function login(data: ObjTy) {
  return request({
    url: "/user/login",
    method: "post",
    data,
  });
}

// 查看所有权限
export function queryAllPermissions(data: ObjTy) {
  return request({
    url: "/permission/queryAllPermissions",
    method: "post",
    data,
  });
}

// 查询用户权限
export function queryUserPermissions(data: ObjTy) {
  return request({
    url: "/permission/queryUserPermissions",
    method: "post",
    data,
  });
}

// 角色列表
export function roleQueryRoleByPage(data: ObjTy) {
  return request({
    url: "/role/queryRoleByPage",
    method: "post",
    data,
  });
}

// 查询角色权限
export function queryRolePermissions(data: ObjTy) {
  return request({
    url: "/permission/queryRolePermissions",
    method: "post",
    data,
  });
}

// 角色删除
export function roleDel(data: ObjTy) {
  return request({
    url: "/role/del",
    method: "post",
    data,
  });
}

// 添加角色
export function addUserRole(data: ObjTy) {
  return request({
    url: "/role/add",
    method: "post",
    data,
  });
}

// 编辑角色
export function roleEdit(data: ObjTy) {
  return request({
    url: "/role/edit",
    method: "post",
    data,
  });
}

// 获取用户列表
export function queryUserByPage(data: ObjTy) {
  return request({
    url: "/user/queryUserByPage",
    method: "post",
    data,
  });
}

// 添加用户
export function userAdd(data: ObjTy) {
  return request({
    url: "/user/add",
    method: "post",
    data,
  });
}

// 编辑用户(禁用 启用)
export function userEdit(data: ObjTy) {
  return request({
    url: "/user/edit",
    method: "post",
    data,
  });
}

// 权限添加（菜单）
export function permissionAdd(data: ObjTy) {
  return request({
    url: "/permission/add",
    method: "post",
    data,
  });
}

// 权限编辑（菜单）
export function permissionEdit(data: ObjTy) {
  return request({
    url: "/permission/edit",
    method: "post",
    data,
  });
}

// 权限删除（菜单）
export function permissionDel(data: ObjTy) {
  return request({
    url: "/permission/del",
    method: "post",
    data,
  });
}
// 文章列表
// export function article() {
//     return request({
//       url: "/profile ",
//       method: "get"
//     });
//   }
